using System;
using System.Collections.Generic;
using System.Text;

namespace Zsa.Emulation
{
    public static class NesMemoryConstants
    {
        #region Main Memory
        /// <summary>
        /// The battery ram start address
        /// </summary>
        public const int MainMemoryStart = 0;

        /// <summary>
        /// The last byte in the save ram.
        /// </summary>
        public const int MainMemoryEnd = 0x07FF;

        /// <summary>
        /// The length of the battery ram.
        /// </summary>
        public const int MainMemoryByteSize = 0x800;



        #region Main Memory Mirrors

        /// <summary>
        /// The start of the main memory mirror1
        /// </summary>
        public const int MainMemoryMirrorTwoStart = 0x800;

        /// <summary>
        /// Mirror three start.
        /// </summary>
        public const int MainMemoryMirrorThreeStart = 0x1000;

        /// <summary>
        /// Mirror three start.
        /// </summary>
        public const int MainMemoryMirrorFourStart = 0x1800;

        /// <summary>
        /// The mirror 4 end.
        /// </summary>
        public const int MainMemoryMirrorFourEnd = 0x1FFF;

        #endregion Main Memory Mirrors

        #endregion Main Memory



        #region IO Registers
        /// <summary>
        /// The battery ram start address
        /// </summary>
        public const int IORegistersStart = 0x2000;

        public const int SoundIOStart = 0x4000;

        /// <summary>
        /// The sprite dma register.
        /// </summary>
        public const int SpriteDMARegister = 0x4014;

        public const int ApuVerticalClockSignalRegister = 0x4015;

        public const int JoyPadOneRegister = 0x4016;

        public const int JoyPadTwoRegister = 0x4017;

        /// <summary>
        /// The last byte in the save ram.
        /// </summary>
        public const int IORegistersEnd = 0x401F;

        /// <summary>
        /// The length of the battery ram.
        /// </summary>
        public const int IORegistersByteSize = IORegistersEnd - IORegistersStart;

        #endregion Battery Ram

        #region Expansion Rom
        /// <summary>
        /// The battery ram start address
        /// </summary>
        public const int ExpansionRomStart = IORegistersStart + 1;

        /// <summary>
        /// The last byte in the save ram.
        /// </summary>
        public const int ExpansionRomEnd = 0x6000;

        /// <summary>
        /// The length of the battery ram.
        /// </summary>
        public const int ExpansionRomByteSize = ExpansionRomEnd - ExpansionRomStart;

        #endregion Expansion Rom

        #region Battery Ram
        /// <summary>
        /// The battery ram start address
        /// </summary>
        public const int BatteryRamStart = ExpansionRomEnd + 1;

        /// <summary>
        /// The last byte in the save ram.
        /// </summary>
        public const int BatteryRamEnd = 0x8000 - 1;

        /// <summary>
        /// The length of the battery ram.
        /// </summary>
        public const int BatteryRamByteSize = BatteryRamEnd - BatteryRamStart;

        #endregion Battery Ram

        #region Program Rom
        /// <summary>
        /// The start of the program rom.
        /// </summary>
        public const int PrgRomStart = 0x8000;

        /// <summary>
        /// The last byte in the program rom.
        /// </summary>
        public const int PrgRomEnd = 0xFFFF;

        /// <summary>
        /// The bank two start positon.
        /// </summary>
        public const int PrgRomBankOneEnd = 0xBFFF;

        /// <summary>
        /// The program rom bank two start position.
        /// </summary>
        public const int PrgRomBankTwoStart = 0xC000;

        /// <summary>
        /// The program rom address length.
        /// </summary>
        public const int PrgRomByteSize = 0x8000;

        /// <summary>
        /// The size of a single bank.
        /// </summary>
        public const int PrgRomBankByteSize = 0x4000;

        
        #endregion Program Rom

    }


}
